package pers.zr.vlumino.chinesechess.ai.zobrist;

public final class VerifyCode {

    /**
     * 每个棋子在棋盘每个位置对应的随机值
     * 对于棋盘上的每种情况，我们对每种棋子在棋盘上对应的校验码的和进行异或运算得到hash，用同样的方式得到校验码。
     * 需要校验码的原因是hash可能会有重复
     */
    public static final int[][] verifyCode = {
            {7755333, 7629732, 5999345, 5436017, 8541456, 8470596, 9949807, 4888288, 1048942, 5030713, 4303699, 9333092, 7003934, 7602331, 8577556, 7473848, 3956824, 6978234, 9327013, 3295001, 1174440, 6519554, 5230693, 3982317, 1621076, 978385, 3738536, 7115851, 5581653, 1576246, 9549794, 3887586, 44723, 1107006, 8281574, 5144588, 8090035, 1162966, 8347038, 6169851, 4214786, 5975360, 283066, 4286829, 4784667, 3815649, 5550403, 609981, 7610235, 7421505, 6174985, 3562484, 1026141, 9491519, 2507372, 7143595, 790138, 7935198, 8847908, 1351975, 2620805, 8269925, 5718429, 5657621, 9257327, 7324122, 3157041, 8963858, 3551670, 3235921, 1570700, 1112197, 3292888, 1629266, 5401029, 1656684, 9215313, 6804391, 142006, 1370683, 4956786, 9797256, 5093854, 747882, 6610058, 2242546, 2645684, 7620623, 9949947, 6117464},
            {9850134, 2942497, 5420777, 4648593, 9586447, 9768464, 4533096, 8931694, 6704144, 5514591, 6445600, 8144393, 9197637, 1690837, 197672, 8624264, 5682859, 8474113, 6309863, 8539924, 8230144, 3725222, 1284133, 400303, 3953343, 7352056, 9912594, 3227357, 9663333, 2282804, 3242958, 9860057, 1364787, 2736717, 4550862, 2562555, 4408280, 8966333, 1733664, 1877038, 705513, 5193863, 2167291, 9491817, 6573623, 4075802, 5257147, 5787816, 8495264, 6703621, 8666056, 6681671, 4364356, 1884756, 6516662, 2401262, 4633072, 2246910, 1742670, 2909530, 1183867, 7570042, 202750, 835073, 1721041, 7674213, 1172888, 2973027, 4009532, 8177814, 7397433, 5687372, 7384338, 2489516, 8006014, 7875840, 8612184, 2508607, 9292980, 7551207, 5407718, 8682221, 1607954, 4547814, 3689771, 7304287, 5420560, 2379752, 4008883, 9239840},
            {5999304, 6857204, 8485503, 9619699, 4084099, 7710041, 2069003, 2474293, 9433799, 2172836, 960812, 7761814, 5194648, 6253020, 6640697, 794615, 3662426, 234020, 6093435, 5679199, 8200576, 9857758, 7553790, 5058883, 1828527, 3586000, 6370935, 8184612, 308898, 9357603, 7439170, 8138190, 6439187, 1338781, 9049957, 6893544, 2693059, 8306122, 7991037, 3825453, 1358232, 507123, 7251559, 9261509, 4882476, 1110614, 5787881, 9721894, 4266147, 1689530, 4462903, 5602910, 29157, 8571022, 3492472, 5233988, 8532226, 8344041, 4515637, 1474279, 6246708, 6332051, 4751206, 8313701, 5944261, 1418633, 1611273, 5304711, 1717039, 4256314, 3613095, 7074824, 4241095, 3594046, 7463872, 3656303, 3760083, 7226299, 1788728, 4918217, 5893336, 9896863, 5130354, 8997412, 4561840, 382991, 9569507, 298783, 7077559, 3940619},
            {1598741, 7371536, 8756062, 4308950, 8727473, 4766970, 8289298, 1552798, 3704649, 5844649, 554882, 8163654, 8216041, 5417629, 540146, 6045488, 4446336, 2113781, 623713, 1278934, 5991946, 379025, 3584273, 1887532, 9268625, 1159669, 5395712, 6222299, 2778715, 8474831, 5119678, 6035989, 4386012, 6326288, 4021146, 8835967, 6091988, 6691899, 2409480, 8684693, 1715268, 4710076, 646943, 3259421, 5346986, 1586637, 268571, 7687751, 7487852, 9241657, 2221767, 2443298, 1368443, 3262794, 1860935, 3415778, 4112451, 2342891, 4521914, 7162422, 6123326, 3053467, 1252947, 3302681, 7357943, 8542050, 1593343, 9035790, 996634, 8540147, 9167972, 7840806, 3427121, 5929931, 6305164, 5561339, 4430608, 2041612, 5887560, 2282268, 2991464, 8839731, 2209880, 7673290, 2247656, 1205483, 7744571, 804268, 1757289, 6633487},
            {9405713, 2829883, 6477302, 2835249, 6153528, 2396203, 9633586, 5977897, 9596310, 9139331, 1007482, 3585588, 623505, 226407, 3071841, 6492329, 8043158, 8531784, 4880487, 3658770, 9698888, 8746301, 7648187, 2151842, 2605998, 9485134, 6553878, 2134990, 6273289, 5289798, 458154, 3328015, 2566583, 2312458, 4946672, 5069414, 6221953, 5425747, 4394376, 6850419, 2431054, 2518927, 5591129, 9988759, 1797953, 3821249, 8877530, 3971514, 8406281, 235980, 2710431, 2920229, 3737491, 4873646, 4110836, 8617821, 7745460, 6240581, 542585, 6585608, 8519623, 9869003, 8428439, 810142, 3658285, 7567374, 9730853, 893327, 9725708, 9924889, 807966, 2635674, 981012, 8221546, 7101015, 9361319, 4943910, 6475270, 3117581, 6654810, 301716, 3000209, 9645800, 7603466, 2164048, 3555334, 9167854, 9125442, 736071, 4930114},
            {6036769, 2512472, 2108119, 8644053, 138749, 2927588, 4048942, 9329515, 1483982, 3271938, 5441805, 1322293, 8452047, 7571143, 5317128, 1985, 4263760, 7830494, 6312267, 1504298, 4659516, 6169576, 7828547, 5570007, 4734841, 970767, 6157551, 1500338, 4417141, 1762379, 2413183, 6456149, 163258, 2606015, 4232912, 8668356, 5115726, 7869088, 3901117, 5519625, 1176247, 7437231, 3799366, 7912415, 4238181, 657679, 9902933, 7856079, 8165489, 9603538, 5419795, 5785752, 4013805, 2610157, 9607836, 7768377, 8460011, 8458680, 1307893, 456273, 9439878, 68154, 2794775, 3416239, 7589053, 4106423, 7175300, 4292270, 9240878, 9541340, 1751894, 2152511, 455207, 3827682, 522197, 8326204, 1835629, 161464, 1299621, 2053901, 738156, 3032182, 6816717, 354348, 882700, 2164843, 4612707, 7653983, 9349307, 6867470},
            {7508440, 930099, 7474360, 3786097, 5036526, 386278, 5257649, 1118086, 6321326, 4008793, 8549406, 1445958, 6592953, 6745246, 4507129, 3527709, 2771368, 1501809, 3595177, 615960, 8371128, 9672966, 5745881, 9177088, 4354290, 3497797, 4209062, 7242813, 498418, 1179355, 3087595, 6050571, 1348609, 8408827, 3589824, 2115290, 1886899, 6703703, 9625367, 9424051, 679357, 9799277, 5529037, 3056429, 2450652, 4225372, 7418309, 6207126, 7787789, 9155277, 4972966, 2323863, 4989211, 3631434, 2271268, 2872301, 7952383, 6352515, 4725186, 9101096, 4432444, 4349096, 4127936, 3104040, 1006450, 2080218, 5360272, 9462530, 4642213, 1750696, 6397681, 3800476, 5897658, 8979125, 7918845, 8695061, 5466101, 5339101, 36405, 560594, 4034792, 751260, 1454319, 3359055, 5238523, 4221311, 701743, 6289705, 2867053, 999321},
            {1634, 2971521, 6424550, 7878084, 9802916, 9056009, 3641220, 6053491, 6038304, 3694275, 4601728, 2737391, 2765547, 7831083, 9781973, 8543499, 8083, 8909939, 3475241, 7559525, 331763, 7247080, 4840705, 973719, 7977570, 4068560, 1121697, 3141657, 1215874, 5003472, 1458125, 1059141, 1996058, 5687668, 5156873, 4349669, 6935972, 8056137, 5285963, 3080022, 228944, 6888599, 7022716, 4985072, 2141731, 6221609, 313101, 2013018, 6435011, 4351880, 8088924, 8494810, 6258745, 4329302, 4541434, 9696621, 857891, 4074491, 2764418, 31784, 4769705, 6554521, 7456770, 4788714, 7102033, 5811825, 6314001, 7873887, 952723, 9065069, 3240090, 774049, 2063471, 8587148, 7575544, 4709381, 1397133, 9614264, 6164479, 8779462, 8485725, 2151382, 9272992, 1796405, 1117057, 5213190, 7123038, 4454648, 2211122, 1776013},
            {1120503, 1504462, 6583078, 1514965, 2733081, 676291, 8697881, 6261940, 3413046, 6245653, 7492296, 43880, 961953, 333373, 5873243, 1547089, 1298751, 4303517, 597121, 1902180, 9719755, 5951481, 2892981, 4795580, 2428349, 5567245, 1413080, 9087331, 7364307, 5413901, 6877597, 6351284, 3176982, 2679121, 2125967, 7052567, 6563655, 5537340, 2195502, 9438573, 1133727, 5602970, 6518655, 4643536, 5461426, 7760066, 9363525, 9993065, 4054127, 121442, 5237859, 43864, 2590365, 2700289, 3135031, 1505196, 7971047, 3269951, 7221193, 3862431, 4479344, 2842596, 1845973, 2259420, 9659172, 1215057, 5604806, 2995192, 7399166, 5110252, 2589202, 4851849, 1148447, 7585128, 8931928, 1394344, 7192483, 7581169, 9287324, 369148, 6481786, 2761085, 982629, 6377655, 3633118, 7105374, 3234440, 2111497, 3412360, 7135036},
            {5045105, 1610762, 8260137, 7081775, 8177058, 6242440, 5235758, 3844630, 948810, 395264, 7131950, 7152038, 4504517, 9248414, 452368, 8990913, 5679737, 5395404, 2445775, 9069398, 9619209, 4590793, 455252, 9847539, 898164, 3436171, 9467769, 5500200, 4056924, 3433245, 7938859, 4069107, 3179183, 6505616, 7719145, 1016003, 5427641, 6827221, 1223870, 5406470, 5296313, 2594213, 7863576, 7034038, 4747049, 9238382, 2193496, 3936805, 9368526, 2504064, 8241209, 4963845, 2229142, 5796789, 8036532, 1316272, 5190978, 1260769, 7494597, 4317907, 2110175, 8153649, 9492500, 4063067, 9569777, 5260759, 2231869, 5044077, 8574316, 6327453, 794162, 378681, 4981087, 8786932, 1172428, 5837619, 7351285, 6422297, 9002750, 8515181, 8374884, 6025373, 9720525, 2690684, 56307, 6601215, 2931194, 7196325, 3443687, 7215993},
            {1411986, 4437017, 842686, 6197321, 4350689, 1100321, 2176553, 69886, 5179432, 4549722, 7437315, 5345590, 6675887, 6912043, 4018677, 86231, 9881282, 949883, 1129433, 5018078, 8824047, 7952523, 3456883, 5901533, 39876, 8083871, 2782940, 9845389, 4443448, 7893517, 9351344, 8304029, 9234000, 8027137, 4442583, 8607227, 9206373, 6564976, 1833817, 4046070, 91160, 9872301, 8604332, 9774807, 1361979, 3363216, 5092725, 8087286, 2324887, 9159367, 9720245, 1987975, 3244380, 6267617, 6865397, 401352, 2762404, 1605850, 5008152, 1849828, 3931223, 6973649, 7957765, 5979159, 3807963, 7894659, 4136452, 3921642, 5748107, 5150046, 7611843, 9161219, 9287157, 8777515, 9854352, 300945, 9814131, 7327939, 3041301, 5932097, 9117537, 2251746, 4137846, 9665526, 8323890, 8429755, 3955434, 309699, 6750821, 7068254},
            {6921760, 8166191, 3761242, 6445702, 5391854, 3462212, 5832037, 9328468, 6988167, 7051100, 7740142, 3265656, 4678206, 6685525, 5020886, 1428105, 7081482, 4404475, 4667870, 7174241, 843229, 1873937, 2420655, 5105540, 7820564, 882503, 7925953, 5016942, 7297464, 5616957, 3559983, 2852609, 7478116, 1829243, 8764106, 4545049, 1103936, 5555019, 9372800, 4445642, 7197716, 655352, 602495, 9947242, 4659104, 126923, 3121743, 7854557, 3718777, 862441, 3937636, 6075635, 8104415, 5341807, 7710368, 6287812, 4179759, 6595870, 9547248, 9374098, 3288748, 4708472, 7329471, 5631037, 69935, 4108800, 189367, 6016650, 2602082, 954865, 9882823, 9037156, 9900034, 9020315, 3491031, 263756, 8500691, 670538, 9137638, 7925805, 2662067, 6750420, 1221864, 8544331, 2044177, 5504890, 8045088, 1149873, 6648646, 6014735},
            {2647846, 7271260, 1264663, 6054013, 7176171, 6586960, 702120, 7761685, 2160608, 4898259, 2688438, 7068944, 4718251, 1913584, 7463827, 4435025, 3877542, 1225870, 1830401, 5118141, 6977573, 3819934, 693786, 6944472, 8408056, 9464428, 981573, 2337001, 833084, 7422986, 1231128, 9227303, 9481279, 9061785, 5110033, 2397218, 2086846, 135800, 8665593, 2783685, 630522, 9803626, 9195555, 7328807, 6156376, 6750804, 8290402, 6068593, 4629821, 194179, 2818279, 6327604, 54222, 4994882, 5406802, 6123094, 877865, 5625128, 321725, 181046, 7100070, 3314070, 1550621, 2327828, 8424624, 4340554, 7370457, 7445053, 8310719, 5145686, 9711124, 4661495, 4835990, 1705702, 7222711, 1004823, 6913222, 6435700, 8112492, 1347157, 3591747, 5787400, 2538309, 6152349, 4926502, 5659143, 4628242, 3269173, 5212168, 9753931},
            {1042153, 3813466, 3256771, 8101399, 6398887, 5043571, 9808576, 9102174, 5863635, 5057261, 9252052, 8658157, 1723155, 5124681, 1253157, 4219839, 3872248, 5520626, 8161117, 9911864, 3793090, 9830835, 5663355, 1290583, 7829741, 880804, 7442160, 4742473, 8343324, 8671938, 9396148, 7049842, 679101, 7008702, 5366514, 5230310, 9784855, 861744, 4247532, 5399185, 2790699, 935817, 7862720, 2108860, 2893635, 5397627, 52512, 6386996, 5485893, 1267570, 46275, 1525302, 9624272, 9590676, 7380920, 563305, 6658419, 9175854, 1380346, 8366591, 3119179, 3428916, 5524370, 4216573, 6813861, 3603635, 5912794, 7908903, 3483455, 9656471, 3469666, 3500256, 6347537, 6814383, 1534792, 48259, 2395838, 1951488, 4053966, 7956940, 7381089, 8919181, 4706371, 2870135, 6126028, 6085616, 3997034, 6447880, 5978110, 2514299}
    };

    /**
     * 获得校验码
     *
     * @param id 棋子类型
     * @param x  棋子坐标x
     * @param y  棋子坐标y
     * @return 校验值
     */
    public static int getVerifyOfId(int id, int x, int y) {
        int a = id < 0 ? id + 7 : id + 6;
        return verifyCode[a][x * 9 + y];
    }
}
